package com.zxtech.zzm.core.ui

import android.os.Bundle
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.zxtech.zzm.core.R
import com.zxtech.zzm.core.util.DeviceUtil

class DebugActivity : AppCompatActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_debug)
    initView()
    initData()
  }

  private fun initData() {
    build_modle?.text = "Build.MODLE:${DeviceUtil.getDeviceType()}"
    package_name?.text =
      "软件包名:${getString(R.string.app_name)}|${DeviceUtil.getAppPackageName(this)}"
    val sb = StringBuffer(
        "软件版本:${DeviceUtil.getAppVersionName(this)}(${DeviceUtil.getAppVersionCode(this)}),"
    )
    if (DeviceUtil.isDebug()) {
      sb.append("DEBUG")
    } else {
      sb.append("RELEASE")
    }
    version_name_code?.text = sb.toString()
    android_name_code?.text =
      "Android版本:${DeviceUtil.translateAndroidVersion()}(${DeviceUtil.getAndroidSDKVersionCode()} - ${DeviceUtil.getAndroidSDKVersionName()})"
  }

  private var build_modle: TextView? = null
  private var version_name_code: TextView? = null
  private var package_name: TextView? = null
  private var android_name_code: TextView? = null

  private fun initView() {
    build_modle = findViewById(R.id.build_modle)
    package_name = findViewById(R.id.package_name)
    version_name_code = findViewById(R.id.version_name_code)
    android_name_code = findViewById(R.id.android_name_code)
  }
}